package com.project.mapper;

import com.project.bean.OrderBean;
import com.project.bean.ShopBean;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 订单mapper接口
 */
public interface IOrderMapper {
    /**
     * 添加订单
     * @param order 订单对象
     */
    public void addOrder(OrderBean order);

    /**
     * 添加订单明细
     * @param orderId 订单id
     * @param shopList 订单明细集合
     */
    public void addOrderInfo(@Param("orderId") int orderId,
                            @Param("shopList") Collection<ShopBean> shopList);

    /**
     * 查看订单详情
     * @param id 订单Id
     * @return
     */
    public OrderBean findById(int id);

    public List<OrderBean> findAllByUserId(int userId);

    public List<OrderBean> findAllByItem(@Param("status") String status,
                                        @Param("startDate") LocalDate startDate,
                                        @Param("endDate") LocalDate endDate);

    public void updateState(@Param("id")int id,@Param("state") String state);

}
